#region Using Statements
using System;
using System.Collections.Generic;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Storage;
using XNALibrary.Interfaces;
using XNALibrary.Cameras;
using XNALibrary.Entities;
using XNALibrary.Skybox;
using XNALibrary.PostProcessing;
using XNALibrary.Landspace;
#endregion

namespace Test1
{
    public class StateManager
    {
        private List<State> states;
        private int index;

        public List<State> States
        {
            get { return states; }
            set { states = value; }
        }

        public StateManager()
        {
            states = new List<State>();
            index = 0;
        }

        public void Initialize(ContentManager content, GraphicsDevice device)
        {
            foreach (State s in states)
                s.Initialize();
        }

        public void NextState()
        {
            if(states.Count > 1)
                index = (index + 1) % states.Count;
        }

        public void PreviousState()
        {
            if (states.Count > 1)
            {
                index--;
                if (index < 0)
                    index = states.Count - 1;
            }
        }

        public void Update()
        {
            states[index].Update();
        }

        public void Draw()
        {
            states[index].Draw();
        }
    }
}
